﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameServer.Virtual_Objects;

using GameServer.Managers;

namespace GameServer.Networking.Handlers
{
    class HANDLE_DELETE_CostumeItem : PacketHandler
    {
        public override void Handle(Virtual_Objects.User.virtualUser User)
        {
            try
            {
                string RemoveItem = getNextBlock();
                int InventoryLength = int.Parse(getNextBlock());

                if (User.hasCostume(RemoveItem))
                { 
                        DB.runQuery("DELETE FROM inventory_costume WHERE ownerid='" + User.UserID + "' AND itemcode='" + RemoveItem + "'");
                        User.Costume = new CostumeItem[35];
                        User.LoadItems();
                        User.send(new Packets.PACKET_DELETE_COSTUME(User, RemoveItem));
                        User.send(new Packets.PACKET_CREDITS(User));
                }
                else
                    User.disconnect();
            }
            catch { }
        }
    }
}